﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
    xmlns:vm="clr-namespace:Microsoft.OpenTurf.Silverlight.ViewModel"
    xmlns:local="clr-namespace:Microsoft.OpenTurf.Silverlight"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    x:Class="Microsoft.OpenTurf.Silverlight.MenuView">

    <UserControl.DataContext>
        <Binding Path="Menu" Mode="OneWay" Source="{StaticResource Locator}"/>
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot">
        <StackPanel Orientation="Vertical" VerticalAlignment="Top">
            <ItemsControl ItemsSource="{Binding MenuItems}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Vertical" VerticalAlignment="Top">
                            <TextBlock Text="{Binding Title}" ToolTipService.ToolTip="{Binding Summary}"/>
                            <ItemsControl x:Name="MenuItemsContainer" ItemsSource="{Binding Feeds}">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Content="{Binding Title}" ToolTipService.ToolTip="{Binding Summary}">
                                            <i:Interaction.Triggers>
                                                <i:EventTrigger EventName="Click">
                                                    <cmd:EventToCommand Command="{Binding Menu.MenuClicked, Source={StaticResource Locator}}" PassEventArgsToCommand="True" />
                                                </i:EventTrigger>
                                            </i:Interaction.Triggers>
                                        </CheckBox>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <!-- // Hack: This will Need to be replaced with a Wrap Control for MenuComponents -->
            <TextBlock Text="{Binding CommunityTitleText}"/>
            <CheckBox Content="{Binding TwitterButtonText}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <cmd:EventToCommand Command="{Binding TwitterClicked}" PassEventArgsToCommand="True" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </CheckBox>
            <!-- // Hack: Stop Replacing -->
        </StackPanel>
    </Grid>
</UserControl>